
--[[

    slimui - Copyright (c) 2011 atom0s, All rights reserved.

    See Copyright notice in slimui.lua
    
]]--

class 'Pen: Object' { ... };

----------------------------------------------------------------------------------
-- func: Pen.__init__
-- desc: Constructor called when this object is first created.
----------------------------------------------------------------------------------
function Pen.__init__( self )
    Object.__init__( self );
end

----------------------------------------------------------------------------------
-- func: Pen:Create
-- desc: Not implemented. Error on call.
----------------------------------------------------------------------------------
function Pen:Create( parent )
    slimui:err( 'not implemented' );
end

----------------------------------------------------------------------------------
-- func: Pen:Bind
-- desc: Binds this pen object to the given pen.
----------------------------------------------------------------------------------
function Pen:Bind( pen )
    if pen == nil then
        slimui:err( 'Pen:Bind - parent pen cannot be nil' );
    end
    
    local class = object_getClassName( pen );
    if string.lower( class ) ~= 'tpen' then
        slimui:err( 'Pen:Bind - cannot bind to objects that are not a pen!' );
    end
    
    self._object = pen;
    
    return self;
end

----------------------------------------------------------------------------------
-- func: Pen:GetColor
-- desc: Returns the color of this pen.
----------------------------------------------------------------------------------
function Pen:GetColor( )
    return pen_getColor( self._object );
end

----------------------------------------------------------------------------------
-- func: Pen:SetColor
-- desc: Sets the color of this pen.
----------------------------------------------------------------------------------
function Pen:SetColor( color )
    pen_setColor( self._object, color );
end

----------------------------------------------------------------------------------
-- func: Pen:GetWidth
-- desc: Returns the width of this pen.
----------------------------------------------------------------------------------
function Pen:GetWidth( )
    return pen_getWidth( self._object );
end

----------------------------------------------------------------------------------
-- func: Pen:SetColor
-- desc: Sets the width of this pen.
----------------------------------------------------------------------------------
function Pen:SetWidth( width )
    pen_setWidth( self._object, width );
end



--[[ Debug information. ]]--------------------------------------------------------
if ( slimui:isdebug() == true ) then
    slimui:msg( '(Control) pen.lua successfully loaded.' );
end